<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"     
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./template/template_1.xhtml">
    <head>
        <link type="text/css" rel="stylesheet" href="themes/bluesky/skin.css" />

    </head>
    <ui:define name="content">

        <f:view>
            <h:form>
                <h1><h:outputText value="List"/></h1>
                <p:dataTable value="#{mp3LibraryMBean.detailsSong}" var="item"
                             emptyMessage="No customer found with given criteria"
                             widgetVar="customerTable" 
                             paginator="true"  
                             rows="20">
                    <f:facet name="header">    
                        <p:outputPanel>    
                            <h:outputText value="Search all fields:" />    
                            <p:inputText id="globalFilter" onkeyup="customerTable.filter()" style="width:150px" />    
                        </p:outputPanel>    
                    </f:facet>    

                    <p:column sortBy="#{item.titre}"
                              filterBy="#{item.titre}"
                              filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="Titre"/>
                        </f:facet>
                        <h:commandLink action="#{userManagedBean.addSongIntoPlayer(item)}" value="#{item.titre}"/>
                    </p:column>

                    <p:column sortBy="#{item.artistes}"
                              filterBy="#{item.artistes}"  
                              filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="Artiste"/>
                        </f:facet>
                        <h:outputText value="#{item.afficherArtiste()}"/>
                    </p:column>

                    <p:column sortBy="#{item.albums}"
                              filterBy="#{item.albums}"  
                              filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="Albums"/>
                        </f:facet>
                        <h:outputText value="#{item.afficherAlbums()}"/>
                    </p:column>

                    <p:column sortBy="#{item.genre}"
                              filterBy="#{item.genre}"  
                              filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="genre"/>
                        </f:facet>
                        <h:outputText value="#{item.genre}"/>
                    </p:column>

                </p:dataTable>
            </h:form>
        </f:view>
        <h:form>
            <h:panelGrid columns="2" cellpadding="5">  
                <h:outputLabel for="path" value="Path: (ex: c:/)" />
                <p:inputText value="#{mp3LibraryMBean.path}"
                             id="path" required="true" label="path"/>
                <f:facet name="footer">
                    <p:commandButton value="chargement mp3" update="dataTable"
                                     actionListener="#{mp3LibraryMBean.test}"/>
                </f:facet>
            </h:panelGrid>
        </h:form>
    </ui:define>

</ui:composition>
